package com.web.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.web.pojo.Contract;

public interface ContractMapper {
	
	/**
	 * 全部查询
	 * @return List<Contract>
	 */
	@Select("SELECT * FROM coutract ")
	public List<Contract> listContract();
	/**
	 * 合同ID查询合同
	 * @param contractID
	 * @return Contract
	 */
	@Select("SELECT * FROM coutract WHERE contractID= #{contractID} ")
	public Contract contractByContractID(String contractID);
	/**
	 * 用户名称查询
	 * @param userName
	 * @return List<Contract>
	 */
	@Select("SELECT * FROM coutract WHERE userName = #{userName} ")
	public List<Contract> contractByUserName(String userName);
	/**
	 * 区域查询
	 * @param areaName
	 * @return List<Contract>
	 */
	@Select("SELECT * FROM coutract WHERE areaName = #{areaName} ")
	public List<Contract> contractByAreaName(String areaName);
	/**
	 * 根据contractID更新订单
	 * @param contract
	 * @return boolean
	 */
	@Update("update coutract set userName=#{userName},areaName=#{areaName},consumerName=#{consumerName},endConsumeraggregateAmount=#{endConsumeraggregateAmount},paybackPeriod=#{paybackPeriod},amountRatio=#{amountRatio},ticketDate=#{ticketDate},planReturnAmount=#{planReturnAmount},planReturnDate=#{planReturnDate},returnStatus=#{returnStatus},planReturnRemark=#{planReturnRemark} where contractID= #{contractID} ")
	public boolean contractUpdateBycontractID(Contract contract);
	/**
	 * 根据合同ID删除合同
	 * @param contractID
	 * @return boolean
	 */
	@Delete("DELETE FROM coutract WHERE contractID = #{contractID} ")
	public boolean deleteByContractID(String contractID);
	
}
